/*
 * @Author: Jiraiya
 * @Date: 2020-03-31 14:21:07
 * @LastEditors: Jiraiya
 * @LastEditTime: 2020-04-07 19:26:40
 * @Description: 
 */
const path = require('path');
const AddAssetHtmlPlugin = require('add-asset-html-webpack-plugin');
const DllReferencePlugin = require('webpack/lib/DllReferencePlugin');
const BundleAnalyzerPlugn = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
    mode: 'development',
    entry: {
        index: path.resolve(__dirname, '../index.js'),
    },
    output: {
        filename: '[name].js',
        path: path.resolve(__dirname, '../dist'),
    },
    module: {
        rules: [
            {
                test: /\.js$/,
                loader: 'babel-loader',
            }
        ],
    },
    plugins: [
        new DllReferencePlugin({
            manifest: require('../dist/common.manifest.json'),
        }),
        new HtmlWebpackPlugin({
            template: 'index.html',
            filename: 'index.html',
            dll:'common.dll.js',
        }),
        // new AddAssetHtmlPlugin([
        //     { filepath: require.resolve('../dist/common.dll.js') },
        // ])
    ],
    devtool: 'source-map',
};
